package com.yuyang.wifi.dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.yuyang.wifi.R;

import androidx.annotation.Nullable;


/**
 * 用户协议与隐私协议对话框
 */

public class UserProtocolDialog extends CommonDialog {

    private TextView tvAgreeInto, tvNotAgree, tvUserProtocol, tvPrivacyProtocol;
    private Context mContext;

    public static UserProtocolDialog newInstance() {
        UserProtocolDialog dialog = new UserProtocolDialog();
        Bundle data = new Bundle();
        dialog.setArguments(data);
        return dialog;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public int getLayoutId() {
        return R.layout.dialog_user_protocol_layout;
    }


    @Override
    public void viewCreated(View view, @Nullable Bundle savedInstanceState) {

        tvUserProtocol = (TextView) view.findViewById(R.id.tv_user_protocol);
        tvPrivacyProtocol = (TextView) view.findViewById(R.id.tv_privacy_protocol);
        tvAgreeInto = (TextView) view.findViewById(R.id.tv_agree_into);
        tvNotAgree = (TextView) view.findViewById(R.id.tv_not_agree);

        tvUserProtocol.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mDialogListener != null) {
                    mDialogListener.onSendCode();
                }
            }
        });
        tvPrivacyProtocol.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mDialogListener != null) {
                    mDialogListener.onInputConfirm();
                }
            }
        });

        tvAgreeInto.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mDialogListener != null) {
                    mDialogListener.onConfirm();
                }
            }
        });

        tvNotAgree.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mDialogListener != null) {
                    mDialogListener.onCancel();
                }
            }
        });

    }

    public void setData(Context context) {
        this.mContext = context;
    }

    @Override
    public boolean isCancelable() {
        return false;
    }
}
